//
//  MyOrderPluPkgs.m
//  X-Touch2
//
//  Created by shengchao yang on 12-6-14.
//  Copyright (c) 2012年 foxhis. All rights reserved.
//

#import "MyOrderPluPkgs.h"
#import "Common.h"
#import "DataBaseAccess.h"

@implementation MyOrderPluPkgs
@synthesize momLocalMenu;
@synthesize ppCode;
@synthesize pkgCode;
@synthesize pkgDescripts;
@synthesize pkgTemp;
@synthesize pkgNumber;
@synthesize pkgPrice;
@synthesize pkgUnit;
@synthesize pkgCook;

//=========================================================== 
// - (id)init
//
//=========================================================== 
- (id)init
{
    self = [super init];
    if (self) {
    }
    return self;
}

-(void)updateNumber:(NSString *)newNumber {
    NSString * updateSql = [NSString stringWithFormat:@"update MyOrderPluPkgs set pkgNumber='%@' where momLocalMenu='%@' and ppCode='%@' and pkgCode='%@' and pkgPrice='%@' and pkgUnit like '%%%@%%'", newNumber, momLocalMenu, ppCode, pkgCode, pkgPrice,JsonField(pkgUnit)];
    [DataBaseAccess Update:updateSql];
}
-(void)updateCook:(NSString *)newCook {
    NSString * updateSql = [NSString stringWithFormat:@"update MyOrderPluPkgs set pkgCook='%@' where momLocalMenu='%@' and ppCode='%@' and pkgCode='%@' and pkgPrice='%@' and pkgUnit like '%%%@%%'", newCook, momLocalMenu, ppCode, pkgCode, pkgPrice,JsonField(pkgUnit)];
    [DataBaseAccess Update:updateSql];
}
-(void)updateName:(NSString *)newName {
    NSString * updateSql = [NSString stringWithFormat:@"update MyOrderPluPkgs set pkgDescripts='%@' where momLocalMenu='%@' and ppCode='%@' and pkgCode='%@' and pkgPrice = '%@' and pkgUnit like '%%%@%%'", newName, momLocalMenu, ppCode, pkgCode, pkgPrice,JsonField(pkgUnit)];
    [DataBaseAccess Update:updateSql];
}
-(void)updatePrice:(NSString *)newPrice {
    NSString * updateSql = [NSString stringWithFormat:@"update MyOrderPluPkgs set pkgPrice='%@' where momLocalMenu='%@' and ppCode='%@' and pkgCode='%@' and pkgPrice = '%@' and pkgUnit like '%%%@%%'", newPrice, momLocalMenu, ppCode, pkgCode, pkgPrice,JsonField(pkgUnit)];
    [DataBaseAccess Update:updateSql];
}
-(void)deletePluPkg{
    NSString * updateSql = [NSString stringWithFormat:@"delete from MyOrderPluPkgs where momLocalMenu='%@' and ppCode='%@' and pkgCode='%@' and pkgPrice='%@' and pkgUnit like '%%%@%%'", momLocalMenu, ppCode, pkgCode, pkgPrice, JsonField(pkgUnit)];
    [DataBaseAccess Update:updateSql];
}
//===========================================================
// dealloc
//=========================================================== 
- (void)dealloc{    
    [momLocalMenu release];
    momLocalMenu = nil;
    [ppCode release];
    ppCode = nil;
    [pkgCode release];
    pkgCode = nil;
    [pkgDescripts release];
    pkgDescripts = nil;
    [pkgTemp release];
    pkgTemp = nil;
    [pkgNumber release];
    pkgNumber = nil;
    [pkgPrice release];
    pkgPrice = nil;
    [pkgUnit release];
    pkgUnit = nil;
    [pkgCook release];
    pkgCook = nil;
    [super dealloc];
}
@end
